package org.dromara.easyai.extensions.ascend;

import org.dromara.easyai.extensions.ascend.core.LibUtilsCannx;

/**
 * @author: wen.y
 * @date: 2025/6/19
 */
public class JCannx {

	private static final String VERSION = "0.0.3";
	private static boolean initialized = false;


	public static void initialize() {
		if (!initialized) {
			String libraryName =  "jcannx_" + VERSION.replaceAll("\\.", "_");
			LibUtilsCannx.loadLibrary(libraryName);
			initialized = true;
		}
	}

	/**
	 * 初始化资源
	 * @return
	 */
	public static native int init();

	/**
	 * 矩阵相乘
	 * @param x
	 * @param y
	 * @param r
	 * @param m
	 * @param k
	 * @param n
	 * @return
	 */
	public static native int matrixMul(float[] x, float[] y, float[] r, int m, int k, int n);

	/**
	 * 释放资源
	 */
	public static native int release();

	/**
	 * 获取版本号
	 * @return
	 */
	public static String version() {
		return VERSION;
	}

}
